﻿using System;
using System.Windows.Input;
using ExtendPropertyLib.WPF;

namespace ExORMDesginer.UserControls
{
    public class ParametersListBoxViewModel : ViewModelBase<ParametersListBoxInfo>
    {

        public event EventHandler ParameterTypeChanged;

        public override void OnDoCreate(ExtendPropertyLib.ExtendObject item, params object[] args)
        {
            base.OnDoCreate(item, args);


            ParameterTypeChangedCommand = this.RegisterCommand(OnTypeChanged);

        }

  

        public ICommand ParameterTypeChangedCommand { set; get; }

        private void OnTypeChanged(object obj)
        {
            if(obj!=null)
                 Model.loadCount++;
            if (Model.loadCount > Model.Parameters.Count)
            {
                if (ParameterTypeChanged != null)
                    ParameterTypeChanged(obj,null);
            }
        }
        
    }
}
